import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 
 */

/**
 * @author newtribe
 *
 */
public class RdpProcessor extends Processor{

	  public RdpProcessor(Server parent, int seq) {
	    super(parent, seq);
	  }
	  /**
	   * logger instance .
	   */
	  public static Log log =LogFactory.getLog(RdpProcessor.class) ;
	  /**
	   * server state information  instance
	   */
	 
	  /**
	   * init out runtime environment .
	   *
	   */
	  public void init() {

	  }
	  


	  /**
	   * when accept , process a socket .
	   * @param socket
	   * @throws java.lang.Exception
	   */
	  public void process(Socket socket ) throws Exception {
	    InputStream fromin = socket.getInputStream() ;
	    OutputStream fromout  =socket.getOutputStream() ;
	    
//	   Socket  remoteSocket =new Socket("192.168.11.130",3389);
//  	  System.out.println("connect 192.168.11.130:3389");
//  	  
//      InputStream toin = remoteSocket.getInputStream() ;
//      OutputStream toout  =remoteSocket.getOutputStream() ;
// 
	   
	    fromout.flush();
	    //wait some seconds

	    boolean OK =false  ;

	    byte[] cache =new byte[1024*2 ] ;
	    while ( !OK ) {

	      int n =fromin.read(cache) ;
	      if( n == -1) //client close .
	        break   ;
	      
	   //   toout.write(cache, 0, n);
	       String protocal =new String(cache,0,n).toUpperCase() ;
	       log.info("=======================:"+protocal);
	       
	    
	    }
	    log.info("=================== system exit");
	    }




	  public static void main(String[] args) {
	  }

}